import {
  Button,
  Icon,
  Title,
  Text,
  Space,
  Row,
  Col,
  Grid,
  GridItem,
  Layout,
  Header,
  Content,
  Footer,
  List,
  ListItem,
  Card,
  Collapse,
  Panel,
  Split,
  Menu,
  MenuItem,
  Submenu,
  Tabs,
  TabPane,
  Dropdown,
  DropdownMenu,
  DropdownItem,
  Page,
  Steps,
  Step,
  Form,
  FormItem,
  Input,
  RadioGroup,
  Radio,
  CheckboxGroup,
  Checkbox,
  Switch,
  Table,
  Select,
  Option,
  DatePicker,
  Cascader,
  Upload,
  Login,
  Modal,
  Message,
  Image,
  Tree,
  Tooltip,
  Poptip,
  Progress,
  Tag,
  Spin,
  Divider
} from 'view-ui-plus'

const iviewRegister = (app: any) => {
  const components: any = {
    Button,
    Icon,
    Title,
    Text,
    Space,
    Row,
    Col,
    Grid,
    GridItem,
    Layout,
    Header,
    Content,
    Footer,
    List,
    ListItem,
    Card,
    Collapse,
    Panel,
    Split,
    Menu,
    MenuItem,
    Submenu,
    Tabs,
    TabPane,
    Dropdown,
    DropdownMenu,
    DropdownItem,
    Page,
    Steps,
    Step,
    Form,
    FormItem,
    Input,
    RadioGroup,
    Radio,
    CheckboxGroup,
    Checkbox,
    Switch,
    Table,
    Select,
    Option,
    DatePicker,
    Cascader,
    Upload,
    Login,
    Modal,
    Image,
    Tree,
    Tooltip,
    Poptip,
    Progress,
    Tag,
    Spin,
    Divider
  }

  for (let componentName in components) {
    app.component(componentName, components[componentName])
  }

  // Message全局配置并注入调用方法
  Message.config({
    duration: 2.5
  })
  window.$Message = Message
  // app.provide('$Message', Message)
  app.provide('$Modal', Modal)
}

export default iviewRegister
